package com.yanqu.road.server.cmd.vehicle;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.vehicle.VehicleProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.vehicle.VehicleModule;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.S_VEHICLE_VERIFY_RECYCLE_PASSWORD, desc = "验证二级密码")
public class VehicleVerifyRecyclePassWordCmd extends AbstractCommand {

	private VehicleProto.RecyclePassWordVerifyReqMsg reqMsg;
	private VehicleProto.RecyclePassWordRespMsg.Builder respMsg;
	@Override
	public boolean parseData(YanQuMessage packet) throws Exception {
		reqMsg = VehicleProto.RecyclePassWordVerifyReqMsg.parseFrom(packet.getBytes());
		return true;
	}

	@Override
	public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
		respMsg = player.getModule(VehicleModule.class).verifyRecyclePassWord(reqMsg);
	}

	@Override
	public void sendData(GamePlayer player) {
		player.sendPacket(Protocol.U_VEHICLE_VERIFY_RECYCLE_PASSWORD , respMsg);
	}

}
